<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Sets socket options</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="eventutil.getsocketname.html">EventUtil::getSocketName</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="eventutil.sslrandpoll.html">EventUtil::sslRandPoll</a></div>
 <div class="up"><a href="class.eventutil.html">EventUtil</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="eventutil.setsocketoption" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EventUtil::setSocketOption</h1>
  <p class="verinfo">(PECL event &gt;= 1.6.0)</p><p class="refpurpose"><span class="refname">EventUtil::setSocketOption</span> &mdash; <span class="dc-title">Sets socket options</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-eventutil.setsocketoption-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type">bool</span> 
   <span class="methodname"><strong>EventUtil::setSocketOption</strong></span>
    ( <span class="methodparam">
    <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
     <code class="parameter">$socket</code>
   </span>
   , <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$level</code>
   </span>
   , <span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$optname</code>
   </span>
   , <span class="methodparam">
    <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span>
     <code class="parameter">$optval</code>
   </span>
   )</div>

  <p class="para rdfs-comment">
   Sets socket options.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-eventutil.setsocketoption-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>

     <em><code class="parameter">socket</code></em>
    </dt>

    <dd>

     <p class="para">
      Socket resource, stream, or numeric file descriptor associated with the
      socket.
     </p>
    </dd>

   
   
    <dt>

     <em><code class="parameter">level</code></em>
    </dt>

    <dd>

     <p class="para">
      One of
      <em>EventUtil::SOL_*</em>
      constants. Specifies the protocol level at which the option resides. For
      example, to retrieve options at the socket level, a
      <em><code class="parameter">level</code></em>
      parameter of
      <strong><code>EventUtil::SOL_SOCKET</code></strong>
      would be used. Other levels, such as TCP, can be used by specifying the
      protocol number of that level. Protocol numbers can be found by using
      the
      <span class="function"><a href="function.getprotobyname.html" class="function">getprotobyname()</a></span>
      function. See
      <a href="class.eventutil.html#eventutil.constants" class="link">EventUtil constants</a>
      .
     </p>
    </dd>

   
   
    <dt>

     <em><code class="parameter">optname</code></em>
    </dt>

    <dd>

     <p class="para">
      Option name(type). Has the same meaning as corresponding parameter of
      <span class="function"><a href="function.socket-get-option.html" class="function">socket_get_option()</a></span>
      function. See
      <a href="class.eventutil.html#eventutil.constants" class="link">EventUtil constants</a>
      .
     </p>
    </dd>

   
   
    <dt>

     <em><code class="parameter">optval</code></em>
    </dt>

    <dd>

     <p class="para">
      Accepts the same values as
      <em><code class="parameter">optval</code></em>
      parameter of the
      <span class="function"><a href="function.socket-get-option.html" class="function">socket_get_option()</a></span>
      function.
     </p>
    </dd>

   
  </dl>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-eventutil.setsocketoption-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success. Otherwise <strong><code>FALSE</code></strong>.
  </p>
 </div>

 <div class="refsect1 seealso" id="refsect1-eventutil.setsocketoption-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">
    <span class="function"><a href="function.socket-get-option.html" class="function" rel="rdfs-seeAlso">socket_get_option()</a> - Gets socket options for the socket</span>
   </li>
   <li class="member">
    <span class="function"><a href="function.socket-set-option.html" class="function" rel="rdfs-seeAlso">socket_set_option()</a> - Sets socket options for the socket</span>
   </li>
  </ul>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="eventutil.getsocketname.html">EventUtil::getSocketName</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="eventutil.sslrandpoll.html">EventUtil::sslRandPoll</a></div>
 <div class="up"><a href="class.eventutil.html">EventUtil</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
